package com.java8.predicatetest;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.function.Consumer;
import java.util.function.Predicate;

/**
 * @Author HBZ
 * @Date 2020/8/5 10:58
 * @Description
 */
public class PredicateTest {

    public static void main(String[] args) {
        Predicate<String> predicate = p -> p.length() > 5;
        System.out.println(predicate.test("hello"));
        System.out.println(predicate.test("hello6"));
        //////////////////
        MyPredicate<String> myPredicate = p -> p.length() > 5;
        System.out.println(myPredicate.test("hello"));
        System.out.println(myPredicate.test("hello6"));
        MyPredicate<Integer> myPredicate1= p -> p > 5;
        System.out.println(myPredicate1.test(6));

    }

    public static String processFile() throws IOException {
        try (BufferedReader br =
                     new BufferedReader(new FileReader("data.txt"))) {
            return br.readLine();
        }
    }
}
